aboutsummaryrefslogtreecommitdiffstats
path: root/templates/etc_jail.conf.d_[jailname].conf.j2
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-10-22 22:45:15 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-10-22 22:45:15 +0300
commit5263aa814da9852294ea64c77af22a1cd2507fca (patch)
tree4bfec8e587cb34b803cb14f6d32fa3ee7381a118 /templates/etc_jail.conf.d_[jailname].conf.j2
parentfea0aff43b6c7cc14ba848f97afb17999ff65c17 (diff)
Improvements
Diffstat (limited to 'templates/etc_jail.conf.d_[jailname].conf.j2')
-rw-r--r--templates/etc_jail.conf.d_[jailname].conf.j241
1 files changed, 31 insertions, 10 deletions
diff --git a/templates/etc_jail.conf.d_[jailname].conf.j2 b/templates/etc_jail.conf.d_[jailname].conf.j2
index 7f7a049..ce0e7ba 100644
--- a/templates/etc_jail.conf.d_[jailname].conf.j2
+++ b/templates/etc_jail.conf.d_[jailname].conf.j2
@@ -3,26 +3,44 @@
{{ jail.name }} {
# STARTUP/LOGGING/VNET
vnet;
- vnet.interface = "epl{{ jail.num }}b";
persist;
- exec.prestart += "ifconfig epair{{ jail.num }} create || echo 'Failed to create epair{{ jail.num }}'";
- exec.prestart += "ifconfig epair{{ jail.num }}a name epl{{ jail.num }}a";
- exec.prestart += "ifconfig epair{{ jail.num }}b name epl{{ jail.num }}b";
- exec.prestart += "ifconfig epl{{ jail.num }}a up";
- exec.prestart += "ifconfig brlan0 addm epl{{ jail.num }}a";
exec.clean;
+ exec.prestart = "ifconfig epair{{ jail.num }}000 create || echo 'Failed to create epair{{ jail.num }}000'";
+ exec.prestart += "ifconfig epair{{ jail.num }}000a name epl{{ jail.num }}a";
+ exec.prestart += "ifconfig epair{{ jail.num }}000b name epl{{ jail.num }}b";
+ exec.prestart += "ifconfig brlan0 addm epl{{ jail.num }}a";
+ {% if jail.name == "ingress" -%}
+ exec.prestart += "ifconfig epair{{ jail.num }}001 create || echo 'Failed to create epair{{ jail.num }}001'";
+ exec.prestart += "ifconfig epair{{ jail.num }}001a name epw1a";
+ exec.prestart += "ifconfig epair{{ jail.num }}001b name epw1b";
+ exec.prestart += "ifconfig brwan0 addm epw{{ jail.num }}a";
+ {% endif %}
+
exec.start = "/bin/sh /etc/rc";
- exec.poststart = "jexec ${name} ifconfig epl{{ jail.num }}b 192.168.2.{{ jail.num }}/16 up";
+
+ exec.poststart = "ifconfig epl{{ jail.num }}b vnet ${name}";
+ exec.poststart += "jexec ${name} ifconfig epl{{ jail.num }}b up";
exec.poststart += "ifconfig epl{{ jail.num }}a up";
- exec.poststart += "jexec ${name} route add default 192.168.0.1 || echo 'Failed to add default route'";
+ exec.poststart += "jexec ${name} ifconfig epl{{ jail.num }}b 192.168.2.{{ jail.num }}/16";
+ {% for ing in jails -%}
+ {% if ing.name == "ingress" -%}
+ exec.poststart += "jexec ${name} route add default 192.168.2.{{ ing.num }} || echo 'Failed to add default route'";
+ {% endif %}
+ {% endfor %}
{% if jail.name == "ingress" -%}
+ exec.poststart += "ifconfig epw{{ jail.num }}b vnet ${name}";
exec.poststart += "jexec ${name} ifconfig epw{{ jail.num }}b up";
+ exec.poststart += "ifconfig epw{{ jail.num }}a up";
exec.poststart += "jexec ${name} service dhclient restart epw{{ jail.num }}b";
{% endif %}
exec.stop = "/bin/sh /etc/rc.shutdown";
- exec.poststop += "ifconfig epl{{ jail.num }}b -vnet $name"; # workaround to bug 238326: move epl{{ jail.num }}b from the jail to the host when stopping jail services
- exec.poststop += "ifconfig epl{{ jail.num }}b destroy"; # and then destroy the pair by destroying one end of it
+
+ exec.poststop += "ifconfig epl{{ jail.num }}a destroy";
+ {% if jail.name == "ingress" -%}
+ exec.poststop += "ifconfig epw{{ jail.num }}a destroy";
+ {% endif %}
+
exec.consolelog = "/var/log/jail_console_${name}.log";
# PERMISSIONS
@@ -31,6 +49,9 @@
mount.devfs;
{%if jail.name == "postgres" -%}
allow.sysvipc;
+ devfs_ruleset = 5;
+ {% else %}
+ devfs_ruleset = 4;
{% endif %}
# HOSTNAME/PATH